/*
* @Author: 刘润泽
* @Date: 2023-03-12 21:45:20
 * @LastEditors: 刘润泽
 * @LastEditTime: 2023-03-14 19:19:25
* @Description:
*/
package server.business.converter.Converter;


import org.springframework.stereotype.Component;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;


@Component
public class BloodSourceConverter implements Converter<String> {

	@Override
	public Class<String> supportJavaTypeKey() {
		return String.class;
	}

	@Override
	public CellDataTypeEnum supportExcelTypeKey() {
		return CellDataTypeEnum.STRING;
	}

	@Override
	public CellData<String> convertToExcelData(String value, ExcelContentProperty excelContentProperty,
			GlobalConfiguration globalConfiguration) throws Exception {
		if (value == null) {
			return new CellData<>("");
		} else if (value.equals("00")) {
			return new CellData<>("第一医院");
		} else if (value.equals("01")) {
			return new CellData<>("第二医院");
		} else if (value.equals("02")) {
			return new CellData<>("第三医院");
		} else {
			return new CellData<>("错误数据");
		}
	}

	@Override
	public String convertToJavaData(CellData arg0, ExcelContentProperty arg1, GlobalConfiguration arg2)
			throws Exception {
		throw new UnsupportedOperationException("Unimplemented method 'convertToJavaData'");
	}
}
